<template>
  <div class="page_padding">
    <MyNavBar
      :title="fromPage === 'home' ? '公示榜' : '绩效榜'"
      :gobackShow="fromPage === 'home' ? true : false"
      @goback="goback" />
    <div class="cont-box">
      <van-tabs
        v-if="fromPage !== 'home'"
        class="cont-tab"
        :class="isLeader ? 'director_tab' : ''"
        v-model="activeTab"
        :sticky="true"
        title-active-color="#d80a06">
        <van-tab v-if="!isLeader" title="个人绩效" name="0">
          <personal-performance></personal-performance>
        </van-tab>
        <van-tab title="公示榜" name="2">
          <honour-roll></honour-roll>
        </van-tab>
      </van-tabs>
      <honour-roll v-else></honour-roll>
    </div>
  </div>
</template>

<script>
import MyNavBar from '@com/MyNavBar'
import HonourRoll from './components/honourRoll'
import PersonalPerformance from './components/PersonalPerformance'
export default {
  name: 'merits',
  components: {
    MyNavBar,
    HonourRoll,
    PersonalPerformance,
  },
  props: {},
  data() {
    return {
      fromPage: '', // 判断从哪里进入，home-从首页进入
      activeTab: '2',
      isLeader: false,
    }
  },
  created() {
    let { from = '' } = this.$route.query
    this.fromPage = from
    this.isLeader = JSON.parse(sessionStorage.getItem('isLeader'))
  },
  methods: {
    goback() {
      this.$router.go(-1)
    },
  },
}
</script>

<style lang="scss" scoped>
.page_padding {
  .cont-box {
    height: 100%;
    .cont-tab {
      height: 100%;
      background: #f5f5f5;
    }
    .director_tab {
      background: #fff;
    }
    /deep/.van-tabs__wrap {
      height: 40px;
      border-bottom: 1px solid #efefef;
      padding: 0 0;
      .van-tab__text {
        line-height: 40px;
        // font-size: 14px;
      }
    }
  }
}
</style>
